montecarlo
Class Game

java.lang.Object
  extended by montecarlo.Game
All Implemented Interfaces:
java.io.Serializable

public class Game
extends java.lang.Object
implements java.io.Serializable

Class containing logic for a two-player, two-action discrete game of complete information. Data fields contain information on utilities, payoffs, and equilibria associated with the game. Contains methods to generate utilities, calculate equilibria, calculate probabilities and moments, and simulate outcomes. This class represents a game of entry with two players. Outcomes are indexed from 0 to 3, corresponding to both enter, only player 1 enters, only player 2 enters, and both enter respectively.

See Also:
Serialized Form

Constructor Summary
Game(double[] x, long randomSeed)
          Primary constructor for a 2-by-2 game.
 
Method Summary
 Jama.Matrix getMoments(double[] x, java.util.ArrayList<Game> importanceGamesList)
          Return GMM moments, as defined by matching the empirical frequency of an outcome to the probability predicted by the model.
 int getOutcome()
          Returns index of simulated outcome.
 void setOutcome(int outcome)
          Sets index of simulated outcome.
 int simulateOutcome(double[] x)
          Simulates an outcome of the game.
 void updateMoments(Jama.Matrix moments, double[] x, java.util.ArrayList<Game> importanceGamesList)
          Method to update moment vector, starting with an extant moment vector and adding to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game(double[] x,
            long randomSeed)
Primary constructor for a 2-by-2 game.

Parameters:
x - Vector of primitives associated with the game.
randomSeed - Seed for the random-number generator.
Method Detail

getMoments

public Jama.Matrix getMoments(double[] x,
                              java.util.ArrayList<Game> importanceGamesList)
Return GMM moments, as defined by matching the empirical frequency of an outcome to the probability predicted by the model.

Parameters:
x - Vector of unknown parameters.
importanceGamesList - ArrayList of importance games used in importance sampler.
Returns:
Matrix of moments.

updateMoments

public void updateMoments(Jama.Matrix moments,
                          double[] x,
                          java.util.ArrayList<Game> importanceGamesList)
Method to update moment vector, starting with an extant moment vector and adding to it.

Parameters:
moments - Passed Jama.Matrix to add the current set of moments to.
x - Vector of unknown parameters.
importanceGamesList - ArrayList of importance games used in constructing the probabilities.

simulateOutcome

public int simulateOutcome(double[] x)
Simulates an outcome of the game.

Parameters:
x - Vector of unknown parameters.
Returns:
An index specifying which outcome was played.

getOutcome

public int getOutcome()
Returns index of simulated outcome.

Returns:
The index of the simulated outcome.

setOutcome

public void setOutcome(int outcome)
Sets index of simulated outcome.

Parameters:
outcome - The index of the outcome to set.